import datetime as dt
import jwt

def jitsi_opensource_mock_shared_secret(room, username):
  key_content = "meow-secrect"
  appid = "meetsangatel"
  # jisit_header = {
  #   "kid": "jitsi/custom_key_name",
  # }
  exp = dt.datetime.utcnow() + dt.timedelta(days=100)
  email = username + "@emeow.com"
  roomname = appid + "/" + room
  payload = {
    "context": {
      "user": {
        "avatar": "https://i.imgur.com/jo6P5S5.jpeg",
        "name": username,
        "email": email,
        "id": "abcd:a1b2c3-d4e5f6-0abc1-23de-abcdef01fedcba"
      },
      "group": "a123-123-456-789"
    },
    "aud": "jitsi",
    "iss": appid,
    "sub": "*",
    # "room": roomname,
    "room": "*",
    "exp": exp
  }

  # btoken = jwt.encode(algorithm="HS256", key=key_content, headers=jisit_header, payload=payload)
  token = jwt.encode(algorithm="HS256", key=key_content, payload=payload)
  print(token)
  return token
